﻿using System;
using System.Collections.Generic;
using System.Data.Linq;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using DbLibrary;

namespace DbLibrary.DataBase
{
    public class RoleRepository : RepositoryBase<Models.Role, Role>
    {
        protected override Table<Role> GetTable()
        {
            return context.Roles;
        }

        protected override Expression<Func<Role, Models.Role>> GetConverter()
        {
            return c => new Models.Role()
            {
                Id = c.Id,
                Name = c.Name
            };
        }

        protected override void UpdateEntry(Role dbRole, Models.Role role)
        {
            dbRole.Name = role.Name;
        }
    }
}
